﻿using System;
using System.Reflection;
using System.Windows.Forms;

namespace Inaction.UI.ComponentModel.Design
{
    public class CollectionEditor : System.ComponentModel.Design.CollectionEditor
    {
        public CollectionEditor(Type type)
            : base(type)
        {
        }
        protected override System.ComponentModel.Design.CollectionEditor.CollectionForm CreateCollectionForm()
        {
            CollectionEditor.CollectionForm collectionForm = base.CreateCollectionForm();
            FieldInfo field = collectionForm.GetType().GetField("propertyBrowser", BindingFlags.Instance | BindingFlags.NonPublic);
            if (field != null)
            {
                PropertyGrid propertyGrid = (PropertyGrid)field.GetValue(collectionForm);
                propertyGrid.HelpVisible = true;
            }
            return collectionForm;
        }
    }
}
